package com.meisiabc.support;

import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public class Result<T> {
    public static final int OK_CODE = 1;
    public static final String OK_MSG = "OK";

    private int code;
    private String msg;
    private T bean;

    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(int code, String msg, T bean) {
        this.code = code;
        this.msg = msg;
        this.bean = bean;
    }

    public static Result ok() {
        return new Result(OK_CODE, OK_MSG);
    }

    public static <T> Result ok(T bean) {
        return new Result(OK_CODE, OK_MSG, bean);
    }
}
